1 00:00:00,690 --> 00:00:01,910 Hello and welcome. 2 00:00:01,920 --> 00:00:11,030 In this video we are going to create a function that will draw the clock numbers. 3 00:00:11,430 --> 00:00:15,650 So this is what our code looks like at the moment. 4 00:00:15,780 --> 00:00:20,680 And this is what we've been able to achieve so far. 5 00:00:20,700 --> 00:00:27,760 So by the end of this Late Show we should have Plock numbers on the clock. 6 00:00:28,080 --> 00:00:35,310 So what I'm going to do I've already pre staged the code I'm going to add the block of code and do my 7 00:00:35,310 --> 00:00:38,750 best to explain what the code does. 8 00:00:39,030 --> 00:00:43,430 So just underneath it you can call a function. 9 00:00:43,510 --> 00:00:51,170 Anyway if he notices draw a clock function here is inside that function we are also calling this trophy's 10 00:00:51,180 --> 00:00:52,580 function. 11 00:00:52,680 --> 00:00:57,040 We're going to create a form of cord draw numbers. 12 00:00:57,180 --> 00:01:00,690 And again we are going to add that here. 13 00:01:00,750 --> 00:01:03,680 In fact let me do that now. 14 00:01:03,820 --> 00:01:07,290 I'm just going to call this draw 15 00:01:09,570 --> 00:01:19,420 numbers inside the pen this is I'm going to also reference the CIT context and the radius. 16 00:01:19,530 --> 00:01:26,010 So this is going to be a function that I am going to create in a minute. 17 00:01:26,040 --> 00:01:34,050 I'm referencing it inside those clocks and when this clock functioned clock runs it who caught this 18 00:01:34,380 --> 00:01:37,540 and then call this function. 19 00:01:37,800 --> 00:01:40,800 So I'm just going to tab down to the bottom. 20 00:01:40,830 --> 00:01:49,460 This class function here and just add the block of code for our drawn numbers function. 21 00:01:49,560 --> 00:01:55,830 So I've added a block of code that would draw the numbers on the clock so this is the code here. 22 00:01:55,850 --> 00:01:57,140 This is the block of call. 23 00:01:57,420 --> 00:02:00,520 So I'll do my best to run through it with you. 24 00:02:00,780 --> 00:02:03,150 So got a couple of variables here. 25 00:02:03,150 --> 00:02:09,370 Variable call and variable Quad nump we've online 36. 26 00:02:09,390 --> 00:02:18,620 Basically we are set in the font size of the drive object to be half 10 percent of the radius. 27 00:02:18,630 --> 00:02:32,670 That's what this line to six dots line thirty seven and thirty eight is used to set the text. 28 00:02:32,760 --> 00:02:40,120 I meant to the middle and the centre of the print position. 29 00:02:40,170 --> 00:02:46,850 And for the rest of the record from line third in line to 47. 30 00:02:46,950 --> 00:02:58,520 We are calculating the print position for 12 numbers to 85 percent of the radius. 31 00:02:58,590 --> 00:03:01,260 We are going to have that rotated. 32 00:03:01,510 --> 00:03:06,530 I will quote the p y divided by 6. 33 00:03:06,810 --> 00:03:15,300 So we hear what the mass of p y property are divided by 6 for each of the numbers of the clock. 34 00:03:15,300 --> 00:03:18,510 So these are various methods here. 35 00:03:18,560 --> 00:03:20,290 So we using the retard metter. 36 00:03:20,370 --> 00:03:27,870 And we pass in in this variable and here which responder will for the angle and we use in the Translate 37 00:03:27,870 --> 00:03:30,080 method here as also. 38 00:03:30,690 --> 00:03:40,950 As I explained in previous video the translation basically is used to remap a position on the X and 39 00:03:40,950 --> 00:03:44,300 Y axis of the compass. 40 00:03:45,000 --> 00:03:50,590 Here we are looking for the three we rotating using the routed met. 41 00:03:50,610 --> 00:03:55,170 Again this time we are using in negative value here. 42 00:03:55,230 --> 00:03:57,740 Notice on 4 to 1 is a positive. 43 00:03:57,990 --> 00:04:04,190 Fourth that rule is using negative value and only 44 is in the field text. 44 00:04:04,200 --> 00:04:11,760 This is what will actually put the text on the clock and we're referencing the number variable and we're 45 00:04:11,760 --> 00:04:14,640 converting it to string. 46 00:04:14,940 --> 00:04:24,300 Okay and these are the values again here fortify were referencing the routed method used in the variable 47 00:04:24,840 --> 00:04:27,070 we defined on line 34. 48 00:04:27,210 --> 00:04:28,410 We use in the. 49 00:04:28,440 --> 00:04:31,290 Again here we have this values here. 50 00:04:31,470 --> 00:04:42,390 And again we use the return method with negative for this variable so that basically should create the 51 00:04:42,390 --> 00:04:44,070 numbers for the clock. 52 00:04:44,270 --> 00:04:46,910 So I'm just going to save this akhlaghi saved. 53 00:04:46,930 --> 00:04:53,270 Or we can go back to our hysteria and see what it looks like. 54 00:04:53,970 --> 00:04:59,810 Okay the numbers have not showed up so there must be a slight error in the could. 55 00:04:59,970 --> 00:05:03,390 It's going to go back into the court and have a look. 56 00:05:03,430 --> 00:05:06,330 What I may have done wrong. 57 00:05:06,940 --> 00:05:10,410 So let me take a look. 58 00:05:10,440 --> 00:05:14,430 The function is called drop numbers let me see. 59 00:05:14,740 --> 00:05:15,420 Ah okay. 60 00:05:15,430 --> 00:05:22,750 This is where my error is the functions Quadron numbers and I'm just called did draw a number so obviously 61 00:05:22,750 --> 00:05:33,280 it will not run sign it or add it s I save that and try and run refresh the clock again and see. 62 00:05:33,710 --> 00:05:39,700 So now we have the numbers showing up on the face of the clock. 63 00:05:40,040 --> 00:05:46,690 Oh that's excellent So if you are on the same page and you got yours working also many congratulations 64 00:05:47,620 --> 00:05:48,770 in the next lecture. 65 00:05:48,840 --> 00:05:58,260 Are we going to quit this function that will be used to draw the hand for the clock. 66 00:05:58,420 --> 00:06:02,540 So thank you for watching and see you in the next lecture. 67 00:06:02,700 --> 00:06:03,580 Bye for now.